package com.example.server.security;

import javax.validation.Constraint;
import javax.validation.Payload;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import java.lang.annotation.*;

/**
 * @author 86159
 */
@Min(value = 1, message = "用户名必须大于一位")
@Max(value = 5, message = "用户名必须小于六位")
@Constraint(validatedBy = {}) // 不指定其他校验器
@Documented
@Target({ElementType.ANNOTATION_TYPE, ElementType.METHOD, ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface NameValidator {

    String message() default "用户名字数需要在1-6之间";
    Class<?>[] groups() default {};
    Class<? extends Payload>[] payload() default {};

}